﻿<UserControl x:Class="MTGenome.Views.SearchView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:caliburn="http://www.caliburnproject.org"
             xmlns:ui="clr-namespace:MTGenome.UI"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"
             caliburn:Message.Attach="Loaded">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>

        <TextBox Text="{Binding SearchText}" caliburn:Message.Attach="[Event TextChanged] = [Action Search]"  />
        <Button caliburn:Message.Attach="Search" IsDefault="True" Grid.Column="1">Search</Button>

        <ListView ItemsSource="{Binding Results}" Grid.Row="1" Grid.ColumnSpan="2">
            <ListView.ItemContainerStyle>
                <Style TargetType="ListViewItem">
                    <Setter Property="IsSelected" Value="{Binding IsSelected}" />
                </Style>
            </ListView.ItemContainerStyle>
            <ListView.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Text}" />
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>

        <Control x:Name="busyIndicator" Visibility="Collapsed" Style="{StaticResource Spinner}"  Grid.RowSpan="2" Grid.ColumnSpan="2" />
    </Grid>
</UserControl>
